import request from '@/utils/request';

/**
 * 远程控制设备参数
 * @param deviceId {string} 设备id
 * @param host {string} 电源ip
 * @param port {number} 端口
 * @param value {string} 值 0，1，2，3，4，5，6，7，8，9
 */
interface RemoteControlParams {
  deviceId: string;
  host: string;
  port: number;
  value?: string;
}

/**
 * 获取智能电源实时状态
 */
export const getRemoteControlInfo = (params: object) => {
  return request({
    url: `deviceManage/getRemoteControlInfo/${params.type}/${params.deviceId}`,
    params,
  });
};

/**
 * 重启通讯板
 */
export const reset = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/reset',
    params,
  });
};

/**
 * 设置交流充电电流告警
 */
export const SetAcChargingCurrent = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setAcChargingCurrent',
    params,
  });
};

/**
 * 读取交流充电电流告警
 */
export const GetAcChargingCurrent = (params: any) => {
  return request({
    url: '/yhPowerSupply/getAcChargingCurrent',
    params,
  });
};

/**
 * 设置交流充电电压告警
 */
export const SetAcChargingVoltage = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setAcChargingVoltage',
    params,
  });
};

/**
 * 读取交流充电电压告警
 */
export const GetAcChargingVoltage = (params: any) => {
  return request({
    url: '/yhPowerSupply/getAcChargingVoltage',
    params,
  });
};

/**
 * 设置交流电压告警
 */
export const SetAcVoltage = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setAcVoltage',
    params,
  });
};

/**
 * 读取交流电压告警
 */
export const GetAcVoltage = (params: any) => {
  return request({
    url: '/yhPowerSupply/getAcVoltage',
    params,
  });
};

/**
 * 设置环境湿度告警
 */
export const SetAmbHum = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setAmbHum',
    params,
  });
};

/**
 * 读取环境湿度告警
 */
export const GetAmbHum = (params: any) => {
  return request({
    url: '/yhPowerSupply/getAmbHum',
    params,
  });
};

/**
 * 设置环境温度告警
 */
export const SetAmbTemperature = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setAmbTemperature',
    params,
  });
};

/**
 * 读取环境温度告警
 */
export const GetAmbTemperature = (params: any) => {
  return request({
    url: '/yhPowerSupply/getAmbTemperature',
    params,
  });
};

/**
 * 设置电源网络信息
 */
export const setBaseNet = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setBaseNet',
    params,
  });
};

/**
 * 读取电源网络信息
 */
export const GetBaseNet = (params: any) => {
  return request({
    url: '/yhPowerSupply/getBaseNet',
    params,
  });
};

/**
 * 设置电池过放保护值
 */
export const SetBatLowVol = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setBatLowVol',
    params,
  });
};

/**
 * 读取电池过放保护值
 */
export const GetBatLowVol = (params: any) => {
  return request({
    url: '/yhPowerSupply/getBatLowVol',
    params,
  });
};

/**
 * 设置电池低压告警
 */
export const SetBatLowVoltage = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setBatLowVoltage',
    params,
  });
};

/**
 * 读取电池低压告警
 */
export const GetBatLowVoltage = (params: any) => {
  return request({
    url: '/yhPowerSupply/getBatLowVoltage',
    params,
  });
};

/**
 * 设置电池放电切换标准
 */
export const SetBatVolCut = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setBatVolCut',
    params,
  });
};

/**
 * 读取电池放电切换标准
 */
export const GetBatVolCut = (params: any) => {
  return request({
    url: '/yhPowerSupply/getBatVolCut',
    params,
  });
};

/**
 * 设置充电优先级
 */
export const setChargePriority = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setChargePriority',
    params,
  });
};

/**
 * 读取充电优先级
 */
export const GetChargePriority = (params: any) => {
  return request({
    url: '/yhPowerSupply/getChargePriority',
    params,
  });
};

/**
 * 设置最大充电电流
 */
export const SetChargingCurrentMax = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setChargingCurrentMax',
    params,
  });
};

/**
 * 读取最大充电电流
 */
export const GetChargingCurrentMax = (params: any) => {
  return request({
    url: '/yhPowerSupply/getChargingCurrentMax',
    params,
  });
};

/**
 * 设置电源序列号
 */
export const setCommBSN = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setCommBSN',
    params,
  });
};

/**
 * 读取电源序列号
 */
export const GetCommBSN = (params: any) => {
  return request({
    url: '/yhPowerSupply/getCommBSN',
    params,
  });
};

/**
 * 读取通讯板版本信息
 */
export const getCommBInfo = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getCommBInfo',
    params,
  });
};

/**
 * 读取充电控制器版本信息
 */
export const getConInfo = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getConInfo',
    params,
  });
};

/**
 * 设置4路DO端口DO通断
 */
export const setDO = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setDO',
    params,
  });
};

/**
 * 设置智能电源经纬高
 */
export const setJWG = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setJWG',
    params,
  });
};

/**
 * 设置1-6路过流告警
 */
export const SetLimitE = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setLimitE',
    params,
  });
};

/**
 * 读取1-6路过流告警
 */
export const GetLimitE = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getLimitE',
    params,
  });
};

/**
 * 设置电池低压告警声
 */
export const SetLowVoltageVoice = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setLowVoltageVoice',
    params,
  });
};

/**
 * 设置光伏充电电流告警
 */
export const SetPhotovoltaicChargingCurrent = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setPhotovoltaicChargingCurrent',
    params,
  });
};

/**
 * 读取光伏充电电流告警
 */
export const GetPhotovoltaicChargingCurrent = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getPhotovoltaicChargingCurrent',
    params,
  });
};

/**
 * 设置光伏充电电压告警
 */
export const SetPhotovoltaicChargingVoltage = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setPhotovoltaicChargingVoltage',
    params,
  });
};

/**
 * 读取光伏充电电压告警
 */
export const GetPhotovoltaicChargingVoltage = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getPhotovoltaicChargingVoltage',
    params,
  });
};

/**
 * 设置电源温度告警
 */
export const SetPowerTempAlarm = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setPowerTempAlarm',
    params,
  });
};

/**
 * 读取电源温度告警
 */
export const GetPowerTempAlarm = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/getPowerTempAlarm',
    params,
  });
};

/**
 * 设置电源类型
 */
export const setPowerType = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setPowerType',
    params,
  });
};

/**
 * 读取电源类型
 */
export const GetPowerType = (params: any) => {
  return request({
    url: '/yhPowerSupply/getPowerType',
    params,
  });
};

/**
 * 设置远程手动断开输出后自动延时回复时间(秒) 前6路
 */
export const SetReplyTime1 = (params: any) => {
  return request({
    url: 'yhPowerSupply/setReplyTime1',
    params,
  });
};

/**
 * 读取远程手动断开输出后自动延时回复时间(秒) 前6路
 */
export const GetReplyTime1 = (params: any) => {
  return request({
    url: '/yhPowerSupply/getReplyTime1',
    params,
  });
};

/**
 * 设置监控运维服务器
 */
export const setServerIP = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setServerIP',
    params,
  });
};

/**
 * 读取监控运维服务器
 */
export const GetServerIP = (params: any) => {
  return request({
    url: '/yhPowerSupply/getServerIP',
    params,
  });
};

/**
 * 设置NTP授时信息
 */
export const setupNtpInfo = (params: RemoteControlParams) => {
  return request({
    url: 'yhPowerSupply/setupNtpInfo',
    params,
  });
};

/**
 * 读取NTP授时信息
 */
export const GetupNtpInfo = (params: any) => {
  return request({
    url: '/yhPowerSupply/getupNtpInfo',
    params,
  });
};
